function foo(a = 1, b: number) {}
function foo(a = 1, b = 2, c: number) {}
function foo(a = 1, b: number, c = 2, d: number) {}
function foo(a = 1, b: number, c = 2) {}
function foo(a = 1, b: number, ...c) {}
function foo(a?: number, b: number) {}
function foo(a: number, b?: number, c: number) {}
function foo(a = 1, b?: number, c: number) {}
function foo(a = 1, { b }) {}
function foo({ a } = {}, b) {}
function foo({ a, b } = { a: 1, b: 2 }, c) {}
function foo([a] = [], b) {}
function foo([a, b] = [1, 2], c) {}
const foo = (a = 1, b: number) => {};
const foo = (a = 1, b = 2, c: number) => {};
const foo = (a = 1, b: number, c = 2, d: number) => {};
const foo = (a = 1, b: number, c = 2) => {};
const foo = (a = 1, b: number, ...c) => {};
const foo = (a?: number, b: number) => {};
const foo = (a: number, b?: number, c: number) => {};
const foo = (a = 1, b?: number, c: number) => {};
const foo = (a = 1, { b }) => {};
const foo = ({ a } = {}, b) => {};
const foo = ({ a, b } = { a: 1, b: 2 }, c) => {};
const foo = ([a] = [], b) => {};
const foo = ([a, b] = [1, 2], c) => {};

class Foo {
  constructor(
    public a: number,
    protected b?: number,
    private c: number,
  ) {}
};

class Foo {
  constructor(
    public a: number,
    protected b = 0,
    private c: number,
  ) {}
}

class Foo {
  constructor(
    public a?: number,
    private b: number,
  ) {}
}

class Foo {
  constructor(
    public a = 0,
    private b: number,
  ) {}
}

class Foo {
  constructor(a = 0, b: number) {}
}

class Foo {
  constructor(a?: number, b: number) {}
}

const defaultValue = 0;
export function f2(b = defaultValue, a: number) {
  return a + b;
}
export function f3(b?: number, a: number) {
  return b !== undefined ? a + b : a;
}
export function f4(b?: number, a: number, c = defaultValue) {
  return b !== undefined ? a + b + c : a + c;
}